<%@ include file="/WEB-INF/jsp/include/taglib.jsp" %>

<%@ include file="/WEB-INF/jsp/include/taglib.jsp" %>

<div class="entry">
    <div class="entry-left">
        <img src="/static-images/pic-helmet-animated.gif">
    </div>
    <div class="entry-right">
        <div class="entry-header">
            <a href="<c:url value="/viewride.form/${entry.id}"/>">
                <c:out value="${entry.header}"/>
            </a>
        </div>
        <div class="entry-data">
            <fmt:formatDate value="${entry.date}"/>
            <a href="<c:url value="/viewprofile.form/${entry.author.username}"/>">
                <c:out value="${entry.author.fullname}"/>
            </a>
        </div>
        <div class="entry-text">
            <c:out value="${entry.text}"/>
        </div>
        <div class="entry-text">
            <c:if test="${!empty entry.pictures}">
                <a href="<c:url value="/viewentry.form/${entry.id}"/>">
                    <fmt:message key="app.ride.photos"/>
                </a>
            </c:if>
        </div>
        <div class="entry-comment-footer">
            <fmt:message key="app.ride.buddies"/>:
            <c:forEach items="${entry.rideJoinComments}" var="join">
                <c:out value="${join.author.username}"/>  
            </c:forEach>
        </div>
        <div class="entry-comment-footer">
            <c:choose>
                <c:when test="${entry:isAllowedEditing(entry, pageContext.request.remoteUser)}">
                    <a href="<c:url value="/editride.form/${entry.id}"/>">
                        <fmt:message key="app.ride.edit"/>
                    </a>
                    <c:if test="${not entry.cancelled}">
                        .. <a href="<c:url value="/cancelride.form/${entry.id}"/>"
                              onclick="return confirm('<fmt:message key="app.ride.cancel.confirm"/>');">
                        <fmt:message key="app.ride.cancel"/>
                    </a>
                    </c:if>
                </c:when>
                <c:otherwise>
                    <c:choose>
                        <c:when test="${entry:isUserOnRide(entry, pageContext.request.remoteUser)}">
                            <a href="<c:url value="/splitride.form/${entry.id}"/>">
                                <fmt:message key="app.ride.split"/>
                            </a>
                        </c:when>
                        <c:otherwise>
                            <c:if test="${not entry.cancelled}">
                                <a href="<c:url value="/joinride.form/${entry.id}"/>">
                                    <fmt:message key="app.ride.join"/>
                                </a>
                            </c:if>
                        </c:otherwise>
                    </c:choose>
                </c:otherwise>
            </c:choose>
        </div>
    </div>
</div>
